The backward compatibility solution for Xcode 14 is to add two user-defined settings
OLD_LINKER_FLAG_XCODE_1400 = -L/usr/lib/swift
OLD_LINKER_FLAG_XCODE = $(OLD_LINKER_FLAG_XCODE_$(XCODE_VERSION_MAJOR):default=-ld_classic)
The linker command for the OLD_LINKER_FLAG_XCODE_1400 might be adjusted if needed. It just needs to contains something since the empty line won't work.
Then, adjust OTHER_LDFLAGS like that:
OTHER_LDFLAGS = $(inherited) $(OLD_LINKER_FLAG_XCODE)
The result is that Xcode 15 and above will use -ld_classic flag and -L/usr/lib/swift for Xcode 14 preventing ld: library not found for -ld_classic error